home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Menus / Menus_6.AMOS / Menus_6.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  6.1 KB  |  194 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         MENUS 6         * 
  5. '*                         *                  MENU STYLES
  6. '* (c) Europress Software  * 
  7. '*                         * 
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'GENERAL 
  13. '------------------------------------------- 
  14. 'A standard menu is normally displayed as a bar at the top of the screen 
  15. 'with the options running in a vertical column downwards from the titles.
  16. 'The following commands allow many changes to be made to the menu style
  17. 'and its position of display on the screen.
  18. 'Only the basic form of the instruction is shown in the examples and these 
  19. 'can only be used whilst defining your menus.
  20. 'An optional extended form of each command is available which can be used
  21. 'to change the menu styles during program execution:-
  22. '
  23. 'eg.      Menu Line 2         (basic form of the instruction)          
  24. '         Menu Line(2,3)      (extended form of the instruction
  25. '
  26. '------------------------------------------- 
  27. 'Menu Line 
  28. '------------------------------------------- 
  29. 'display menu options as a horizontal line from the title position 
  30. '
  31. 'eg.    Menu Line 2   (draw items at level 2 as a horizontal line) 
  32. '
  33. '------------------------------------------- 
  34. 'Menu Tline
  35. '------------------------------------------- 
  36. 'display menu options as a horizontal line from the left hand edge of screen 
  37. '
  38. 'eg.    Menu Tline 3   (draw items at level 3 as a horizontal line)  
  39. '
  40. '------------------------------------------- 
  41. 'Menu Bar
  42. '------------------------------------------- 
  43. 'this is the default mode of menu display for levels 2 to 8
  44. '
  45. 'eg.    Menu Tline 2   (draw items at level 2 as a vertical bar)   
  46. '
  47. '------------------------------------------- 
  48. 'Menu Inactive 
  49. '------------------------------------------- 
  50. 'turn off a series of menu options 
  51. '
  52. 'eg.    Menu Inactive 4  (disable selection of level 4 options)    
  53. '
  54. '------------------------------------------- 
  55. 'Menu Active 
  56. '------------------------------------------- 
  57. 'reverse effect of Menu Inactive 
  58. '
  59. 'eg.    Menu Active 4  (re-enable selection of level 4 options)    
  60. '
  61. '------------------------------------------- 
  62. 'Menu Static 
  63. '------------------------------------------- 
  64. 'As a default the menu bar may be moved by pressing the left mouse key while 
  65. 'over the first item in a list, Menu Stactic fixes the menu in place.  
  66. '
  67. 'eg.    Menu Static 2  (Disable any movement by user)    
  68. '
  69. '------------------------------------------- 
  70. 'Menu Movable
  71. '------------------------------------------- 
  72. 'reverse effect of Menu Static 
  73. '
  74. 'eg.    Menu Movable 3  (Menu may be moved by user)      
  75. '
  76. '------------------------------------------- 
  77. 'Menu Item Movable 
  78. '------------------------------------------- 
  79. 'allow user to move individual menu items
  80. '
  81. 'eg.    Menu Item Movable 4  (Menu options may be moved by user)         
  82. '
  83. 'Before this command has any effect the main menu bar must be movable. 
  84. '
  85. '------------------------------------------- 
  86. 'Menu Item Static
  87. '------------------------------------------- 
  88. 'reverse effect of Menu Item Movable 
  89. '
  90. 'eg.    Menu Item Static 3  (Menu options may not be moved by user)      
  91. '
  92. 'This is the default condition.  
  93. '
  94. '------------------------------------------- 
  95. 'Menu Separate 
  96. '------------------------------------------- 
  97. 'offset item by 2 pixels 
  98. '
  99. 'eg.    Menu Separate 2  (offset options on level 2)       
  100. '
  101. 'Only works on items that do not have a background string set. 
  102. '
  103. '------------------------------------------- 
  104. 'Menu Link 
  105. '------------------------------------------- 
  106. 'reverse effect of Menu Separate 
  107. '
  108. 'eg.    Menu Link 2  (Link options on level 2)       
  109. '
  110. '------------------------------------------- 
  111. 'Menu Mouse
  112. '------------------------------------------- 
  113. 'display menu at mouse position
  114. '
  115. 'There are 2 possible versions of this instruction:- 
  116. '
  117. '    Menu Mouse On      (display menu at mouse Y coordinate) 
  118. '    Menu Mouse Off     (disable this feature) 
  119. '
  120. '------------------------------------------- 
  121. 'WORKING EXAMPLE 
  122. '------------------------------------------- 
  123. Rem *** tidy up the screen 
  124. '
  125. Screen Open 0,640,200,16,Hires
  126. '
  127. Palette $0,$F00,$F0,$F,$FF,$F0F,$FF0,$F70,$888,$95F,$F07,$5AA,$666,$999,$CCC,$FFF
  128. Flash Off : Curs Off : Cls 0 : Pen 0 : Paper 11
  129. '
  130. Rem *** set the menu titles
  131. '
  132. Menu Separate 2
  133. Menu$(1)="       CONTROL         "
  134. Menu$(2)="       DEMO ITEMS        "
  135. Menu$(3)="       COLOURS      "
  136. '
  137. Rem *** set the options  
  138. '
  139. Menu$(1,1)="        QUIT          "
  140. '
  141. Menu$(2,1)=" MENU MOUSE ON          "
  142. Menu$(2,2)=" MENU MOUSE OFF         "
  143. Menu$(2,3)=" COLOUR OPTIONS MOVABLE "
  144. Menu$(2,4)=" COLOUR OPTIONS STATIC  "
  145. Menu$(2,5)=" CYAN NOT SELECTABLE     "
  146. Menu$(2,6)=" CYAN SELECTABLE         "
  147. '
  148. Paper 0
  149. Pen 1 : Menu$(3,1)="        RED         "
  150. Pen 2 : Menu$(3,2)="        GREEN       "
  151. Pen 3 : Menu$(3,3)="        BLUE        "
  152. Pen 4 : Menu$(3,4)="        CYAN        "
  153. Pen 5 : Menu$(3,5)="        MAGENTA     "
  154. Pen 6 : Menu$(3,6)="        YELLOW      "
  155. Pen 7 : Menu$(3,7)="        ORANGE      "
  156. Pen 8 : Menu$(3,8)="        GREY        "
  157. Pen 9 : Menu$(3,9)="        PURPLE      "
  158. Pen 10 : Menu$(3,10)="        PINK        "
  159. Menu Separate(3,2)
  160. '
  161. '
  162. Rem *** start the automatic checking 
  163. '
  164. Menu On 
  165. On Menu Proc CONTROL,DEMOS,KOLOURS
  166. On Menu On 
  167. Pen 9 : Locate 0,23 : Centre "PRESS RIGHT MOUSE KEY TO SEE MENU"
  168. '
  169. Rem *** loop whilst waiting for menu 
  170. '
  171. Do 
  172. Loop 
  173. '
  174. Procedure CONTROL
  175.    Edit 
  176. End Proc
  177. '
  178. Procedure DEMOS
  179.    On Choice(2) Gosub 1,2,3,4,5,6,7
  180.    On Menu On : Pop Proc
  181.    1 Menu Mouse On : Locate 0,8 : Centre "MENU MOUSE ON " : Return 
  182.    2 Menu Mouse Off : Locate 0,8 : Centre "MENU MOUSE OFF" : Return 
  183.    3 For N=1 To 10 : Menu Movable(3,N) : Next : Locate 0,10 : Centre "TITLE 3 OPTIONS MOVABLE" : Return 
  184.    4 For N=1 To 10 : Menu Static(3,N) : Next : Locate 0,10 : Centre "TITLE 3 OPTIONS STATIC " : Return 
  185.    5 Menu Inactive(3,4) : Locate 0,12 : Pen 7 : Centre "CYAN NOT SELECTABLE" : Return 
  186.    6 Menu Active(3,4) : Locate 0,12 : Centre "  CYAN SELECTABLE  " : Return 
  187. End Proc
  188. '
  189. Procedure KOLOURS
  190.    C=Choice(2)
  191.    Ink C : Pen C
  192.    Locate 0,6 : Centre "NEW COLOUR SELECTED"
  193.    On Menu On 
  194. End Proc